﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasertTemplates.Master" AutoEventWireup="true"
    CodeBehind="CustomerLog.aspx.cs" Inherits="WebApplication.CustomerLog" %>

<%@ Register TagPrefix="uc1" TagName="usermeg" Src="~/UserControl/UserMessageControl.ascx" %>
<%@ Register TagPrefix="uc1" TagName="maintab" Src="~/UserControl/MainTabControl.ascx" %>
<%@ Register TagPrefix="uc1" TagName="Paginator" Src="~/UserControl/PaginatorUC.ascx" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript" src="Media/Js/jquery.query.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            //--搜索框 初始化---------
            SearchTextInit();
            //--搜索按钮 初始化---------
            SearchUrlInit();
            //--排序图标初始化------------
            OrderImg();
            //--分页的跳转 页码初始化------------
            JumpPageInit();
        })

        //--排序--------
        function OrderBy(property_file) {
            var pageName = "CustomerLog.aspx";
            var new_params = '';
            var orderby = $.query.get("ob");
            if (orderby == 'desc') {
                new_params = $.query.set('pp', property_file).set("ob", 'asc').REMOVE('page').toString();
            }
            else {
                new_params = $.query.set('pp', property_file).set("ob", 'desc').REMOVE('page').toString();
            }
            window.location.href = pageName + new_params;
        }
        //--排序结束

        //--排序图标
        function OrderImg() {
            var pp = $.query.get('pp');
            var ob = $.query.get('ob');
            if (pp != null) {
                pp = pp.replace('.','_');
                if (ob == 'desc') {
                    $('#a_' + pp).parent('.hw').parent('th').addClass('headerSortUp').removeClass('headerSortDown');
                }
                else {
                    $('#a_' + pp).parent('.hw').parent('th').addClass('headerSortDown').removeClass('headerSortUp');
                }
            }
            
        }
        //--排序图标结束

        //--分页的跳转 页码初始化------------
        function JumpPageInit() {
            $("#ContentPlaceHolder2_paginator1_txtCur,#ContentPlaceHolder2_paginator2_txtCur").blur(function () {
                var jumpCount = 1;
                var maxCount = $("#ContentPlaceHolder2_paginator1_lblTotalPages").html();
                if (parseInt($(this).val()) > parseInt(maxCount)) {
                    jumpCount = maxCount;
                    $(this).val(maxCount);
                }
                else {
                    jumpCount = $(this).val();
                }
                var newUrl = $.query.set("page", jumpCount).toString();
                $("#ContentPlaceHolder2_paginator1_hyGo").attr("href", newUrl);
                $("#ContentPlaceHolder2_paginator2_hyGo").attr("href", newUrl);
            });
        }
        //--分页的跳转结束------------

        //--查询按钮地址初始化------------
        function SearchUrlInit() {
            $("#ContentPlaceHolder2_txtDateStart,#ContentPlaceHolder2_txtDateEnd").blur(function () {
                var pageName = "CustomerLog.aspx";
                var newUrl = $.query.copy();

                if ($('#ContentPlaceHolder2_txtDateStart').val() != '' && $('#ContentPlaceHolder2_txtDateEnd').val() != '') {
                    newUrl = $.query.set("s", $('#ContentPlaceHolder2_txtDateStart').val()).set("e", $('#ContentPlaceHolder2_txtDateEnd').val()).REMOVE("page").toString();
                }
                else if ($('#ContentPlaceHolder2_txtDateStart').val() != '' && $('#ContentPlaceHolder2_txtDateEnd').val() == '') {
                    newUrl = $.query.set("s", $('#ContentPlaceHolder2_txtDateStart').val()).REMOVE("page").toString();
                }
                else if ($('#ContentPlaceHolder2_txtDateStart').val() == '' && $('#ContentPlaceHolder2_txtDateEnd').val() != '') {
                    newUrl = $.query.set("e", $('#ContentPlaceHolder2_txtDateEnd').val()).REMOVE("page").toString();
                }
                else {
                    newUrl = $.query.REMOVE("s").REMOVE("e").toString();
                }

                $("#ContentPlaceHolder2_hySearch").attr("href", pageName + newUrl);
            });
        }
        //--查询按钮初地址始化结束------------

        //--搜索输入框 初始化 开始
        function SearchTextInit() {
            var newUrl = $.query.copy();
            var startDate = $.query.get('s');
            var endDate = $.query.get('e');
            if (startDate != null) {
                $("#ContentPlaceHolder2_txtDateStart").val(startDate);
            }
            if (endDate != null) {
                $("#ContentPlaceHolder2_txtDateEnd").val(endDate);
            }

            $("#ContentPlaceHolder2_hySearch").attr("href", "CustomerLog.aspx" + newUrl);
        }
        //--搜索输入框 初始化 结束

    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="content-title">
        <h1>
            Customer - Log</h1>
    </div>
    <div class="con-nav">
        <a href="Basicinformation.aspx" class="btn"><span class="ui-icon ui-icon-newwin"></span>
            Add New Customer</a>
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
    <ajaxToolkit:ToolkitScriptManager EnablePartialRendering="true" runat="Server" ID="ScriptManager1" />
    <input type="hidden" value="t24" id="pageName" />
    <uc1:usermeg ID="usermeg" runat="server"></uc1:usermeg>
    <div class="partWrap">
        <uc1:maintab ID="maintab" runat="server" />
        <div class="clear20">
        </div>
        <div>
            <table width="550" border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <td>
                        <asp:TextBox ID="txtDateStart" runat="server" CssClass="input200"></asp:TextBox>
                        <ajaxToolkit:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtDateStart"
                            Format="yyyy-MM-dd" />
                        to
                        <asp:TextBox ID="txtDateEnd" runat="server" CssClass="input200"></asp:TextBox>
                        <ajaxToolkit:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="txtDateEnd"
                            Format="yyyy-MM-dd" />
                    </td>
                    <td>
                        <ul class="uibtn">
                            <li>
                            <asp:HyperLink ID="hySearch" runat="server">Search</asp:HyperLink>
                            </li>
                        </ul>
                    </td>
                </tr>
            </table>
        </div>
        <div class="clear15">
        </div>
        <uc1:Paginator ID="paginator1" runat="server" />
        <div class="table-wrap">
            <table width="100%" border="0" background="#cccccc" cellspacing="1" cellpadding="0"
                class="listing-table" id="timeTable">
                <thead>
                    <tr>
                        <th width="40" style="text-align:left">
                            Index
                        </th>
                        <th>
                            <div class="hw"><span>Done </span></div>
                        </th>
                        <th>
                            <div class="hw"><a id="a_h_LastModifyBy" href='javascript:OrderBy("h.LastModifyBy")'><span>Who </span></a>
                                <%--<span>Who</span>--%><span class="order-1"></span><div class="dragDiv">
                                </div>
                            </div>
                        </th>
                        <th>
                            <div class="hw"><a id="a_hc_HistoryCat_Eng" href='javascript:OrderBy("hc.HistoryCat_Eng")'><span>Category </span></a>
                                <%--<span>Category</span>--%><span class="order-1"></span><div class="dragDiv">
                                </div>
                            </div>
                        </th>
                        
                        <th>
                            <div class="hw"><a id="a_h_LastModifyDate" href='javascript:OrderBy("h.LastModifyDate")'><span>Modify Date </span></a>
                                <%--<span>Modify Date</span>--%><span class="order-1"></span><div class="dragDiv">
                                </div>
                            </div>
                        </th>
                    </tr>
                </thead>
                <tbody>
                    <asp:Repeater ID="Repeater1" runat="server">
                        <ItemTemplate>
                            <tr>
                                <td width="40">
                                    <%# Container.ItemIndex +1%>
                                </td>
                                <td class="td1">
                                    <%# Eval("h.History_Detail")%>
                                </td>
                                <td class="td2">
                                    <%# Eval("h.LastModifyBy")%>
                                </td>
                                <td class="td3">
                                    <%# Eval("hc.HistoryCat_Eng")%>
                                </td>                               
                                 <td class="td8">
                                    <%# DateFormatString2(Eval("h.LastModifyDate"))%>
                                </td>
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                </tbody>
            </table>
            <div class="clear10">
            </div>
        </div>
        <uc1:Paginator ID="paginator2" runat="server" />
    </div>
</asp:Content>
